#coding:utf-8
import time
#自定义过滤函数,
def check_str(args):
    if type(args) is str:
        return 'string'

def unix_time(tms):
    ts=time.strptime(tms,"%Y-%m-%d  %H:%M:%S")
    res=int(time.mktime(ts))
    return res

def date_time(utms):
    if not utms:utms = 0
    tms=time.localtime(utms)
    res= time.strftime("%Y-%m-%d %H:%M:%S",tms)
    return res

def date(utms):
    if not utms: utms=0
    tms=time.localtime(utms)
    res= time.strftime("%Y-%m-%d",tms)
    return res

def str_to_int(strs):
    res=int(strs)
    return res

def to_float(args1):
    tt='%.'+str(1)+'f'
    res=tt % (float(str(args1)))
    return res

def check_type(strs):
    if type(strs) is str:return 'str'
    if type(strs) is int:return  'int'
    if type(strs) is list:return 'list'
    if type(strs) is dict:return 'dict'
    if type(strs) is tuple:return 'tuple'

def is_checked(strs):
    if strs:
        return "checked"
    else:
        return ""
